package com.dj.mingkong.admin.biz.service.music.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dj.mingkong.admin.biz.controller.music.vo.request.BoxMusicQueryVo;
import com.dj.mingkong.admin.biz.controller.music.vo.response.BoxMusicVo;
import com.dj.mingkong.admin.biz.repository.database.music.BoxMusicRepository;
import com.dj.mingkong.admin.biz.service.music.BoxMusicService;
import com.dj.mingkong.common.infrastructure.base.dto.page.PageVo;
import com.dj.mingkong.common.util.SmartBeanCopy;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * 音乐收藏服务实现
 *
 * @author zenglonghui
 * @date: 2022/12/14 11:24
 */
@Slf4j
@Service("boxMusicService")
public class BoxMusicServiceImpl implements BoxMusicService {
    @Resource
    private BoxMusicRepository boxMusicRepository;

    @Override
    public PageVo<BoxMusicVo> pageByVo(BoxMusicQueryVo queryVo) {
        final Page<BoxMusicVo> boxMusicVoPage = boxMusicRepository.getMapper()
                .listPage(Page.of(queryVo.getPage(), queryVo.getPageSize()), queryVo);
        return SmartBeanCopy.copyPageVo(boxMusicVoPage, BoxMusicVo.class);
    }
}
